/*
 * @Description:
 * @Author:
 * @Date: 2025-02-16 16:25:07
 * @LastEditTime: 2025-02-16 16:52:14
 * @LastEditors: XXX
 */
import { Store as VuexStore, type CommitOptions, type DispatchOptions, type Module } from 'vuex'

import type { RootState } from '@/store'
import { state, type TagsViewState } from './state'
import { mutations, type Mutations } from './mutations'
import { actions, type Actions } from './actions'

export type { TagsViewState }

export type TagsStore<S = TagsViewState> = Omit<VuexStore<S>, 'getters' | 'commit' | 'dispatch'> & {
  commit<K extends keyof Mutations, P extends Parameters<Mutations[K]>[1]> (
    key: K,
    payload: P,
    options?: CommitOptions
  ): ReturnType<Mutations[K]>
} & {
  dispatch<K extends keyof Actions> (
    key: K,
    payload: Parameters<Actions[K]>[1],
    options?: DispatchOptions
  ): ReturnType<Actions[K]>
}

export const store: Module<TagsViewState, RootState> = {
  state,
  mutations,
  actions
}
